In 3D computer graphics, much of the information contained within a scene is encoded as surface properties of 3D geometry. Texture mapping, which is an efficient technique for encoding this information as bitmaps, is therefore an integral part of the process of rendering an image. Textures typically consume a large amount of bandwidth in the rendering pipeline and are therefore often compressed with one of a variety of available hardware-accelerated compression schemes.
It is not usually possible to read directly from textures as the projection of 3D geometry often requires some form of re-sampling. MIP (multum in parvo, meaning “much in little”) maps, which comprise a sequence of textures, each of which is a progressively lower resolution representation of a given base texture, are used to increase the speed of rendering by allowing some of this re-sampling to be performed offline. This in turn reduces the bandwidth of texture reads by promoting locality of reference among neighbouring samples. A schematic diagram of a MIP map 100 is shown in FIG. 1. Each successive texture in the sequence of textures 101-106 is half the width and height (i.e. half the resolution) of the previous 2D texture, and the result may be considered as a three-dimensional pyramidal structure with only 4/3 as many samples as the highest resolution texture. Each of these textures 101-106 may be referred to as a ‘MIP map level’ and each is a representation of the same base texture, but at a different resolution. Although the MIP map levels shown in FIG. 1 are square, a MIP map does not have to be square (e.g. MIP map levels may be rectangular), nor does it need to be two dimensional, though this is generally the case. These MIP map levels may then be individually compressed with one of a variety of available hardware-accelerated texture compression schemes (e.g. Adaptive Scalable Texture Compression, ASTC, or PowerVR Texture Compression, PVRTC).
When rendering an image using a MIP map, trilinear filtering may be used. Trilinear filtering comprises a combination of two bilinear filtering operations followed by a linear interpolation (or blend). To render an image at a particular resolution (or level of detail), bilinear filtering is used to reconstruct a continuous image from each of the two closest MIP map levels (i.e. the one at a slightly higher resolution than the required resolution and the one at a slightly lower resolution than the required resolution) and then linear interpolation (or blending) is used to produce an image at the intermediate, and required, resolution. Trilinear filtering is the best re-sampling solution supported on all modern graphics hardware. The terms “filtering” and “re-sampling” will be used interchangeably. Alternatively, each of the blending operations may be substituted with “nearest neighbour” sampling, which when applied inter MIP map level only requires a single MIP map level per sample. This form of MIP map sampling produces a poor approximation of the desired texture re-sampling and introduces discontinuities.
Referring back to the example shown in FIG. 1, to render an image at a resolution which is higher than the resolution of texture 103 but lower than the resolution of texture 102, bilinear filtering is used to reconstruct an image from each of the two textures (or MIP map levels) 102, 103 and then a resultant texture is generated by linearly interpolating between the two reconstructed textures.
The embodiments described below are provided by way of example only and are not limiting of implementations which solve any or all of the disadvantages of known methods of encoding and/or decoding texture data.